
public class Calculator implements ICalculator {
	
	private int x;
	private int y;
	private char operation;

	@Override
	public void setFirstOperand(int x) {
		this.x = x;
	}

	@Override
	public void setSecondOperand(int y) {
		this.y = y;
	}

	@Override
	public void setOperation(char c) {
		this.operation = c;
	}

	@Override
	public int getResult() {
		int result = 0;
		switch(this.operation){
		case '+':
			result = (x + y);
			break;
		case '-':
			result = (x-y);
			break;
		case '*':
			result = (x*y);
			break;
		case '/':
			result = (x/y);
			break;
			default: throw new IllegalArgumentException("Invalid operation");
		}
		return result;
	}

}
